<html>
<head><meta charset="utf-8"><title>rustflags-per-target-per-profile · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html">rustflags-per-target-per-profile</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="219719952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rustflags-per-target-per-profile/near/219719952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html#219719952">(Dec 12 2020 at 18:10)</a>:</h4>
<p>Hi, I have a rustflag I want to add to work around a crash in the compiler <a href="https://github.com/rust-lang/rust/issues/73677#issuecomment-696771880">https://github.com/rust-lang/rust/issues/73677#issuecomment-696771880</a></p>



<a name="219719975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rustflags-per-target-per-profile/near/219719975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html#219719975">(Dec 12 2020 at 18:10)</a>:</h4>
<p>Preferably I can do this in .cargo/config.toml, and only apply the flag in debug builds, is that possible?</p>



<a name="219720076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rustflags-per-target-per-profile/near/219720076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html#219720076">(Dec 12 2020 at 18:12)</a>:</h4>
<p>previously I set the linker script via my target.json, so I could override RUSTFLAGS, but now the linkerscript is set in .cargo/config.toml, I cant set RUSTFLAGS now without it skipping those flags in .cargo</p>



<a name="219720634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rustflags-per-target-per-profile/near/219720634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html#219720634">(Dec 12 2020 at 18:24)</a>:</h4>
<p>Cargo looks for <code>.cargo/config.toml</code> in the current directory first so a workaround I'm using is to create different directories for different profiles then <code>cd</code> into the directory before doing <code>cargo build</code>. This isn't great but it works.</p>



<a name="219720653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rustflags-per-target-per-profile/near/219720653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html#219720653">(Dec 12 2020 at 18:25)</a>:</h4>
<p>The fact that it looks in the current directory is something I dont like!</p>



<a name="219720671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rustflags-per-target-per-profile/near/219720671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html#219720671">(Dec 12 2020 at 18:25)</a>:</h4>
<p>maybe I'll just add that flag always :/</p>



<a name="219720845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/rustflags-per-target-per-profile/near/219720845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/rustflags-per-target-per-profile.html#219720845">(Dec 12 2020 at 18:29)</a>:</h4>
<p>(I wrote a bit here <a href="https://github.com/rust-lang/cargo/issues/8643#issuecomment-742572527">https://github.com/rust-lang/cargo/issues/8643#issuecomment-742572527</a> about how I was using --manifest-path)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>